function [ bell_RMSerror,bell_dtw] = RMSe_resample(velocity,normal_gaussian,task)

% 10% peak bell
[max_v,position] = max(velocity);
%offset
offset_velxy = velocity(position:end);
LastNum = find(offset_velxy < 0.10 * max_v);
offset = LastNum(1) + position -1;

%resample
if (strcmp(task,'FR') == 1)
    resample_velocity = resample(velocity(1:offset),305,offset);
    bell_RMSerror = sqrt(sum((resample_velocity(3:end-3)-normal_gaussian').^2)/300);
    bell_dtw = dtw(resample_velocity(3:end-3),normal_gaussian');
else
    resample_velocity = resample(velocity(1:offset),345,offset);
    bell_RMSerror = sqrt(sum((resample_velocity(3:end-3)-normal_gaussian').^2)/340);
    bell_dtw = dtw(resample_velocity(3:end-3),normal_gaussian');
end

% figure(1)
% hold on,
% plot(resample_velocity(3:end-3),'color','r');
% plot(normal_gaussian,'color','g');
% close;
